﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SocialIn.Biz;

namespace SocialIn.Web.Members
{
    public partial class ChangePaw : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string result = "-1"; // -1 에러, 0 - 변경됨, 1 - 변경실패

            if (HttpContext.Current.Session[ConfigName.SessionMember] != null)
            {
                string password = Request.Form["temp"];
                string oldpassword = Request.Form["oldpass"];

                if (string.IsNullOrEmpty(password) == false ||
                    string.IsNullOrEmpty(oldpassword) == false)
                {

                    string userid = (HttpContext.Current.Session[ConfigName.SessionMember] as Member).UserID;

                    if (!string.IsNullOrEmpty(password))
                    {
                        Join j = new Join();
                        if (j.ChangePassword(oldpassword, password, userid))
                            result = "0";
                        else
                            result = "1";
                    }
                }
            }

            Response.Write(result);
            Response.End();
        }
    }
}